<script>
export default {
  onLaunch: function() {
    console.log('App Launch');
    // 检查登录状态
    this.checkLoginStatus();
  },
  onShow: function() {
    console.log('App Show');
  },
  onHide: function() {
    console.log('App Hide');
  },
  methods: {
    checkLoginStatus() {
      // 检查是否有登录态
      const token = uni.getStorageSync('token');
      if (!token) {
        // 没有登录态，跳转到登录页
        uni.navigateTo({
          url: '/pages/login/login'
        });
      }
    }
  }
};
</script>

<style>
/* 全局样式 */
page {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
    Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei',
    sans-serif;
  background-color: #f3f4f6;
  font-size: 28rpx;
  color: #333;
  box-sizing: border-box;
}

/* 主题色 */
.primary-color {
  color: #9333EA;
}
.primary-bg {
  background-color: #9333EA;
}

/* 通用样式 */
.container {
  padding: 20rpx;
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.text-center {
  text-align: center;
}
.rounded {
  border-radius: 8rpx;
}
.rounded-full {
  border-radius: 999rpx;
}
.shadow {
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
</style>